#pragma once

class CbookcapDlg;

class CCrop : public CWnd
{
	DECLARE_DYNAMIC(CCrop)

public:
	CCrop(CbookcapDlg *parent);
	virtual ~CCrop();

	void		start();
	void		cancel();
	int			getSizeX();
	int			getSizeY();
	COLORREF	getPixel(int x, int y);

protected:
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnPaint();
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);

protected:
	void	captureScreen();
	void	startCrop();

	CDC		m_captureDC;
	CBitmap	m_captureBM;

	CDC		m_shadeDC;
	CBitmap	m_shadeBM;

	CDC		m_alphaDC;
	CBitmap	m_alphaBM;

	CDC		m_backDC;
	CBitmap	m_backBM;

	CRect	m_bigRect;
	CRect 	m_smallRect;

	int		m_alpha;
	int		m_cutoff;
	int		m_mousedown;
	int		m_mouseX;
	int		m_mouseY;
	int		m_mouseXbase;
	int		m_mouseYbase;
	int		m_mouseXend;
	int		m_mouseYend;

	HCURSOR	m_SelectionCursor;
	HCURSOR	m_SavedCursor;

	CbookcapDlg	*m_Parent;
};


